package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicWarehousePriceDetailsDAO;
import com.cssy.xxkj.logic.entity.LogicSalesDO;
import com.cssy.xxkj.logic.entity.LogicWarehousePriceDetailsDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-09-16
 */
public class LogicWarehousePriceDetailsDAOImpl extends SqlMapClientDaoSupport implements LogicWarehousePriceDetailsDAO {

    /**
     * 插入数据
     * @param logicWarehousePriceDetailsDO
     * @return 插入数据的主键
     */
    public String insertLogicWarehousePriceDetailsDO(LogicWarehousePriceDetailsDO logicWarehousePriceDetailsDO) {
        Object id = getSqlMapClientTemplate().insert("LogicWarehousePriceDetails.insert", logicWarehousePriceDetailsDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicWarehousePriceDetailsDO
     * @return 查出的记录数
     */
    public Integer countLogicWarehousePriceDetailsDOByExample(LogicWarehousePriceDetailsDO logicWarehousePriceDetailsDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehousePriceDetails.countByDOExample", logicWarehousePriceDetailsDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicWarehousePriceDetailsDO
     * @return 受影响的行数
     */
    public Integer updateLogicWarehousePriceDetailsDO(LogicWarehousePriceDetailsDO logicWarehousePriceDetailsDO) {
        int result = getSqlMapClientTemplate().update("LogicWarehousePriceDetails.update", logicWarehousePriceDetailsDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicWarehousePriceDetailsDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicWarehousePriceDetailsDO> findListByExample(LogicWarehousePriceDetailsDO logicWarehousePriceDetailsDO) {
        List<LogicWarehousePriceDetailsDO> list = getSqlMapClientTemplate().queryForList("LogicWarehousePriceDetails.findListByDO", logicWarehousePriceDetailsDO);
        return list;
    }

    /**
     * 根据主键获取logicWarehousePriceDetailsDO
     * @param id
     * @return logicWarehousePriceDetailsDO
     */
    public LogicWarehousePriceDetailsDO findLogicWarehousePriceDetailsDOByPrimaryKey(String id) {
        LogicWarehousePriceDetailsDO logicWarehousePriceDetailsDO = (LogicWarehousePriceDetailsDO) getSqlMapClientTemplate().queryForObject("LogicWarehousePriceDetails.findByPrimaryKey", id);
        return logicWarehousePriceDetailsDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicWarehousePriceDetailsDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWarehousePriceDetails.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicWarehousePriceDetailsDO> find(SearchConditions scs) throws DataAccessException {
		List<LogicWarehousePriceDetailsDO> list = getSqlMapClientTemplate().queryForList("LogicWarehousePriceDetails_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehousePriceDetails_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehousePriceDetails_ex.deleteBizRemoved", id);
        return count;
	}
	
	@Override
	public List<LogicWarehousePriceDetailsDO> findQueryEndMonthToSummary(SearchConditions scs){
		/*List<LogicWarehousePriceDetailsDO> list = getSqlMapClientTemplate().queryForList("LogicWarehousePriceDetails_ex.findQueryEndMonthToSummary", scs);
        return list;*/
		return null;
	}

}